package com.woniuxy.spirngaop;

import com.woniuxy.aspect.MyAspect;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @Author: 马宇航
 * @Todo: 基于spring定义一个切面类
 * @DateTime: 01/20/0020 下午 2:40
 * @Component: 成都蜗牛学苑
 **/
public class MyAspectSpring implements MethodInterceptor {
    public void beforeInfo(){
        System.out.println("方法前执行！");
    }
    public void afterInfo(){
        System.out.println("方法后执行！");
    }
    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {
        beforeInfo();
        Object proceed = invocation.proceed();
        afterInfo();
        return proceed;
    }
}
